package cn.ekgc.carddemo.controller;

import cn.ekgc.carddemo.entity.Pagination;
import cn.ekgc.carddemo.entity.Student;
import cn.ekgc.carddemo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;
    @PostMapping("save")
    @ResponseBody
    public Student save(@RequestBody Student student){
        studentService.save(student);
        return student;
    }
    @PostMapping("/list")
    @ResponseBody
    public Map<String,Object> list(@RequestBody Pagination pagination){
        return studentService.list(pagination);
    }
}
